<?php

/**
 * Answer form.
 *
 * @package    tests
 * @subpackage form
 * @author     Djul
 */
class AnswerForm extends BaseAnswerForm
{
  public function configure()
  {
        $c = new Criteria();
      if(!sfContext::getInstance()->getUser()->getGuardUser()->getIsSuperAdmin())
      {
        $c->addJoin(QuestionPeer::TEST_ID, TestPeer::ID);
        $c->addJoin(TestPeer::TEST_BLOCK_ID, TestBlockPeer::ID);
        $c->addJoin(TestBlockPeer::SUBJECT_ID, UserSubjectPeer::SUBJECT_ID);
        $c->addJoin(UserSubjectPeer::USER_ID, sfContext::getInstance()->getUser()->getGuardUser()->getId());
      }

    $this->widgetSchema['question_id'] = new sfWidgetFormPropelChoice(array('model' => 'Question', 'add_empty' => false,'criteria'=>$c));
    $this->validatorSchema['question_id']=new sfValidatorPropelChoice(array('model' => 'Question', 'column' => 'id','criteria'=>$c));
  }
}
